<template>
  <div>
    <head-top :headTitle="headTitle" :showBack="true"></head-top>
    <section class="scroll_container1111">
      <section class="list_container">
        <ul class="deliverable_address1111">
          <li v-for="item in list" :key="item.id" @click="chooseyaodian(item)" :class="{choosed:item.AYID==$route.query.ayid}">
            <span>
              <p class="choose_content1111">
                <span>{{item.YDMC}}</span><span style="color:#666;font-size:0.8rem;margin-left:0.5rem">(距离患者2km)</span>
              </p>
              <p class="choose_place1111">
                电话：{{item.YDDH}}
              <p class="choose_place1111">
                地址：{{item.YDDZ}}
              </p>
            </span>
          </li>
        </ul>
      </section>
    </section>
  </div>
</template>
<script>
import headTop from '~/components/pagetwo/headTop';

export default {
  data() {
    return {
      headTitle: '选择药店',
      ts: this.newStore(),
      list: [],

      iscur: 0,
    };
  },
  created() {
    /* this.$root.showfooter = false; */
    // eslint-disable-next-line no-unused-expressions
    document.title = '选择药店';
    this.getyaodian();
  },
  destroyed() {
    /* this.$root.showfooter = true; */
    /* this.$root.showfooter = false; */
  },
  components: {
    headTop,
  },
  methods: {
    chooseyaodian(item) {
      /*       const mes = window.confirm('确定选择该药房？');
      if (mes) { */
      console.log(this.$route.query.preType);

      if (this.$route.query.preType == 'xy') {
        this.$router.push({
          name: 'openPrescribe1',
          query: {
            patientInfo: this.$route.query.patientInfo,
            ydmc: item.YDMC,
            yddh: item.YDDH,
            ayid: item.AYID,
            yddz: item.YDDZ,
          },
        });
      } else {
        this.$router.push({
          name: 'openPrescribe',
          query: {
            patientInfo: this.$route.query.patientInfo,
            ydmc: item.YDMC,
            yddh: item.YDDH,
            ayid: item.AYID,
            yddz: item.YDDZ,

          },
        });
      }
    },
    getyaodian() {
      const res = JSON.stringify({
        OTRequest: {
          VERSION: '1.0',
          TN: 'F27.APP.01.26',
          CLIENTID: 'YLAPP',
          RYBID: 'DOCTOR',
          TOKEN: `${sessionStorage.getItem('rybToken')}`,
          DATA: {},
        },
      });
      this.spost(this.ts, '/doctor/AppMainServlet.ap', {
        '': res,
      }).then((ts) => {
        this.list = ts.d.DATAOBJ.DATA;
      });
    },
  },
};
</script>
<style scoped>
.scroll_container1111 {
  padding-top: 0.8rem;
}
.choose_place1111{
  word-break: break-all;
  font-size: 0.9rem;
  color: #888;
}
.scroll_container1111 p {
  margin-bottom: 0rem;
}
.scroll_container1111 p:first-child {
  margin-bottom: 0.6rem;
}
.deliverable_address1111 {
  background: #fff;
  margin-bottom: 0;
  overflow: auto;
  margin-top: 2rem;
  border-radius: 0.2rem;
  padding: 0.3rem 0.8rem;
}

.deliverable_address1111 li {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  justify-content: space-between;
  margin: 0.6rem auto;
  box-shadow: 0px 0.1px 0px 1px #e2d1d1;
  border-radius: 0.2rem;
}
.deliverable_address1111 span:nth-child(2) {
  flex-grow: 5;
}
.choose_icon {
  width: 2rem;
  height: 2rem;
  text-align: center;
  line-height: 2rem;
  margin-right: 0.4rem;
}
.choose_icon i {
  font-size: 1.2rem;
  display: block;
}
.icon-selected1 {
  color: #aaa;
}
.choosed {
  background: #e8eaee
}
.choose_content1111 span:first-child {
  font-weight: 400;
  font-family: "Microsoft Yahei";
}

</style>

